<?php
include("db.php");
$id=$_POST['txtId'];
$name=$_POST['txtName'];
$note=$_POST['txtNote'];

if(!empty($note))
{	
	$check="select * from etudiant where photoid='$id'";
	$check_result=mysql_query($check,$link);
	$result_rows=mysql_fetch_object($check_result);
	if($result_rows == null)
	{
		$sql="insert into etudiant(photoid,name) values('$id','$name')";
		mysql_query($sql,$link);
	}	
	
	$sql="insert into etudiant_note(photoid,note) values('$id',$note)";
	mysql_query($sql,$link);
		
	echo "<script>window.location =\"notelist.php\";</script>";
	
}

